﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;
using GMS.Dinasty.BO;


namespace GMS.Dinasty.Reporting
{
    public partial class billNoVatReport : DevExpress.XtraReports.UI.XtraReport
    {
        public billNoVatReport(string distirbutor, string customer, DataTable data, string billNumber, string billDate)
        {
            InitializeComponent();
            xrTableCell20.Text = distirbutor;
            xrTableCell22.Text = customer;
            LoadTable(data, dataSet1.Tables["billTable"]);
            xrLabel2.Text = billNumber;
            xrLabel4.Text = billDate;
        }
        private void LoadTable(DataTable sourceTable, DataTable destinationTable)
        {

            foreach (DataRow drw in sourceTable.Rows)
            {
                DataRow dr = destinationTable.NewRow();
                Good good = new Good(drw["caption"].ToString());
                dr["order"] = drw["order"];
                dr["caption"] = good.StringForForPrint();
                dr["units"] = drw["units"];
                dr["quantity"] = decimal.Parse(drw["quantity"].ToString());
                dr["lowprice"] = drw["lowprice"];
                dr["summ"] = Math.Round(decimal.Parse(dr["quantity"].ToString()) * decimal.Parse(dr["lowprice"].ToString()),2);
                destinationTable.Rows.Add(dr);
            }
        }
    }
}
